import { useState,useEffect } from 'react'

import Router from "./router/index.jsx";
import Style from "./App.module.less"
import { BrowserRouter, Route, useLocation } from 'react-router-dom';
function ScrollToTop() {
  const { pathname } = useLocation();

  useEffect(() => {
    window.scrollTo(0, 0); // 每次路由变化时滚动到顶部
    
  }, [pathname]);
  // useEffect(() => {
  //   const updatePaddingTop = () => {
  //     const paddingTop = `${window.safeAreaInsets?.top}px` || 'constant(safe-area-inset-top)';
  //     document.body.style.paddingTop = paddingTop;
  //   };

  //   window.addEventListener('resize', updatePaddingTop);
  //   updatePaddingTop();

  //   return () => {
  //     window.removeEventListener('resize', updatePaddingTop);
  //   };
  // }, []);
  return null;
}
function App() {
  const [count, setCount] = useState(0)

  return (
		<div className={Style['app_box']} id='ccc'>
    <ScrollToTop />
			<Router />
		</div>
  )
}

export default App
